﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using WcfServer.Classes.Utility;
using System.Security.Cryptography;

namespace Test_Security_Serializer
{
    [Serializable]
    class DataToSend
    {
        public char[] userName= new char[20];
        public char[] IP = new char[32];
        public char[] date = new char[32];
        public char[] hash = new char[32];
        public char[] date2 = new char[32];
        
    }

    class Class1
    {
        static void Main_(string[] args)
        {
            var obj = new List<string>();
            obj.Add("hello");
            obj.Add("arman");
            obj.Add("roozbeh");

            DataToSend obj2 = new DataToSend();
            obj2.userName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".ToCharArray();
            obj2.IP = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".ToCharArray();
            //var xx = sizeof(IPAddress);
            obj2.date = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".ToCharArray();
            obj2.date2 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".ToCharArray();
            obj2.hash = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".ToCharArray();

            var z = SerializerHandler<DataToSend>.SerializeInput(obj2);

            //var t = 
            Aes a = new AesCryptoServiceProvider();
            KeyHandler.deleteKeyFromContainer("Arman");
            KeyHandler.deleteKeyFromContainer("Arman2");
            //EncryptionHandler.GenKey_SaveInContainer("Arman2");
            var tttttttt = KeyHandler.getParamFromContainer("Arman2",true);
            
            var ec = EncryptionHandler.EncryptRSA_XML(z, "Arman2");
            var dc = EncryptionHandler.DecryptRSA(ec, "Arman2");

            var zz = SerializerHandler<DataToSend>.DeSerializeInput(dc);
            
            //var y = SerializerHandler<List<string>>.DeSerializeInput(zz.ddd);

        }
    }
}